<?php

// Security
if (!defined("_ECRIRE_INC_VERSION")) return;

/**
 * Verify that inputed code is the same as the code on captha image
 * Options :
 * - namespace : Securimage namespace. It must be changed if several forms will be used on the same page
 *
 * @param string $valeur
 *   The value to check.
 * @param array $options
 *   The associative array of options
 * @return string
 *   Returns an empty string if it is valid, otherwise a string explaining the error.
 */
function verifier_securimage_dist($valeur, $options=array()){
	$erreur = '';
    
    include_spip("securimage/securimage");    
    $img = new Securimage();
    if (isset($options['namespace']))    
        $img->namespace = $options['namespace'];
    if (!$img->check($valeur))
        $erreur = _T('securimage:wrong_code');
	
	return $erreur;
}

?>
